
function s(){

    let li = document.querySelectorAll(".main-3-1 ul");
    console.log(li);
    let all = document.querySelector("#all");
    console.log(all);

    let allnum = 0;


    //let ul = document.querySelectorAll("ul");
    //console.log(ul);


    for(let i = 0 ; i < li.length ; i++){
        //console.log('单价');
        //console.log(li[i].children[2].children[0].innerHTML);
        //console.log('数量');
        //console.log(li[i].children[3].children[0].value);
        //console.log('小计');
        //console.log(li[i].children[4].children[0]);



        var price = li[i].children[2].children[0].innerHTML;

        var num = li[i].children[3].children[0].value;

        var total = li[i].children[4].children[0].innerHTML = price * num;




        console.log(total);
        allnum += total;

    }
    //总价
    console.log(allnum);
    all.innerHTML = allnum.toFixed(2);
}
s();


let num_all = document.querySelectorAll('.main-3-1 ul .num');
for(let j = 0; j < num_all.length;j++){
    num_all[j].addEventListener('change',s);
}
//
//
let del_all = document.querySelectorAll('.main-3-1 ul .del');
for(let k = 0; k < del_all.length;k++){
    del_all[k].addEventListener('click',function(){
        console.log(this.parentNode.parentNode.parentNode.parentNode);
        console.log(this.parentNode.parentNode.parentNode);
        this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);



    s();
    })

}









